#!/usr/bin/env python3
# coding: utf-8
import numpy as np
import cv2 as cv
file = '../../res/111.jpg'
image = cv.imread(file,cv.IMREAD_GRAYSCALE)
cv.imshow('img',image)

# 64位计算机 , cmd需要& 0xff
cmd = cv.waitKey(0) & 0xff
print("cmd: ",cmd)
if cmd == 27:   # Esc
    cv.destroyAllWindows()
if cmd == ord('s'):
    cv.imwrite('out.png',image)

cv.destroyAllWindows()